package com.jigsaw.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by Jigsaw on 2016/1/28.
 */
@Controller
public class MainController {
    private static Logger log = LoggerFactory.getLogger(MainController.class);

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index() {
        log.debug("aaaaaaaaaaaaaaaaaaaaa = {}", 1111111);
        return "index";
    }

    @RequestMapping(value = "/qq")
    //age 参数是接受 URL 的参数
    public String asd(@RequestParam("age") int age, Model model) {
        log.debug("qqqqqqqqqqqqqqqqqqqqqqqq = {}", age);
        //给模板传值
        model.addAttribute("user", "Asda");
        return "qq";
    }

    @RequestMapping(value = "/ww")
    public String post() {
        log.debug("qqqqqqqqqqqqqqqqqqqqqqqq = {}", 1111111);
        return "post";
    }
}

